<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .content {
            width: 1020px;
            display: flex;
            flex-wrap: wrap;
            margin: auto;
        }

        .content>div {
            width: 150px;
            height: 230px;
            background-color: green;
            margin: 10px;
            color: white;
        }
    </style>
</head>

<body>
    <div class="content">
    </div>
    <script>
        let number = 1;
        function showGoods(limit) {
            let content = '';
            for (let i = 0; i < limit; i++) {content += `<div>${number++}</div>`;}
            document.querySelector('.content').innerHTML += content;
        }
        showGoods(18);
        let y = 0
        window.onscroll = scrool();
        function scrool() {
            let s = null;
            return function () {
                if (s == null) {
                    s = setTimeout(() => {
                        let sy = window.scrollY;
                        if (sy - y <= 0) {   //向上
                            s=null;
                            return;
                        }
                        y = sy;
                        showGoods(6);
                        s=null;
                    }, 500)
                }
            }
        }
    </script>
</body>

</html>